<?php

$login->require_login();

require_once(DIR_MODULES .'/media/media.class.php');

$media_id = $_GET['id'];
$media = new media($media_id);
$resource = new resource($media->fields['resource_id']);

if($resource->id){
  header("content-type:" . $resource->fields['filetype']);
  readfile($resource->filename);
  exit;
}

?>